from rest_framework import serializers

from goods.models import SpecificationOption,SPU


class OptionsSerializer(serializers.ModelSerializer):
    spec = serializers.StringRelatedField(read_only=True)
    spec_id = serializers.IntegerField()
    class Meta:
        # 指定模型类
        model = SpecificationOption
        fields = '__all__'
class SPUSerializer(serializers.ModelSerializer):
    class Meta:
        model = SPU
        fields = ('id','name')
